<?php 
    if(isset($_GET['id'])){
    $id = $_GET['id'];
    $job = Job::model()->findAll("user_id=$id", array('order'=>'user_id'));
?>
<div id="content">
    <div id="main_content" class="fixed clear">
		<div class="fixed">    
			<div class="job_detail" >
			<span class="col_title"><p> <b><?php echo "Thông tin đăng dự án" ;?></b></p></span>
			
				<table class="job_list" width="50%">
							<thead>
								<th width="15%">User name</th>
								<th width="20%">Email</th>
								<th width="15%">Số dự án đã đăng</th>
							</thead>
							<tbody>
								<td align="center"><p> <b><?php echo $model->name ;?></b></p></td>
								<td align="center"><p> <b><?php echo $model->email ;?></b></p></td>
								<td align="center"><p> <b><?php echo  count($job);?></b></p></td>
							</tbody>
				</table>
			
			</div>
		</div>
	
	
    <span class="col_title">Các dự án <?php echo Yii::app()->user->name;?> đã đăng</span>   
        <table class="job_list" width="100%">
            <thead>
                <th width="30%">Name of the project</th>
                <th width="15%">Specialized</th>
                <th width="5%">Bid(s)</th>
                <th width="20%">Money</th>
                <th width="20%">Skill</th>
                <th width="5%">Start</th>
                <th width="5%">End</th>
            </thead>
            <tbody>
			<?php
				foreach ($job as $key):
				if($key->status == 2) {
				$countBid = Bidjob::model()->countByAttributes(array('job_id'=>$key->id));
			?> 
                <tr>
                    <td><?php echo CHtml::link(substr($key->name, 0, 50), array('job/view', 'id'=>$key->id)); ?></td>
                    <td align="center">
						<?php					
							$jobtype = new Job();
							echo $jobtype->getJob($key->subjobtype_id);
						?>
					</td>
                    <td align="center"><?php echo $countBid; ?></td>
                    <td align="center"><?php echo $key->budget->money;?></td>
                    <td align="center"><?php echo $key->skillsrequired;?></td>
                    <td align="center">Today</td>
                    <td align="center">5days</td>
                </tr>
				<?php } ?>
			<?php endforeach; 
             // end if?>
            </tbody>
        </table>
		<?php //if(!isset($_GET['search'])) 
			//$this->widget("CLinkPager", array('pages'=>$page));
		?>
<!--CATEGORIES BEGIN-->

</div>
</div>
<?php
    }else{
        echo "khong ton tai user name nay";
    }
?>
